var limsArchivesManage = Gikam.getPageObject({

    getEditListColumns: function () {
        return [{
            checkbox: true
        },{
            index: true
        }, {
            field: 'status',
            title: 'T_LIMS_ARCHIVES_MANAGE.STATUS',
            type: 'select',
            category: 'sys',
            param: {
                codeCategoryId_EQ: 'archiveStatus'
            },
            styleFormatter: function (row) {
                if (row.status === 'destoryed') {
                    return {backgroundColor: 'red'}
                }
            }
        }, {
            field: 'archivesCode',
            validators: ['strLength[0,10]', 'notEmpty', 'remote[/secure/basemodule/rm/archives-manages/action/validate-unique]'],
            title: 'T_LIMS_ARCHIVES_MANAGE.ARCHIVESCODE',
            type : 'link'
        }, {
            field: 'archivesName',
            validators: ['strLength[0,53]', 'notEmpty'],
            title: 'T_LIMS_ARCHIVES_MANAGE.ARCHIVESNAME'
        }, {
            field: 'archivesType',
            title: 'T_LIMS_ARCHIVES_MANAGE.ARCHIVESTYPE',
            type: 'select',
            category: 'sys',
            firstBlank: false,
            validators: ['strLength[0,8]', 'notEmpty'],
            param: {
                codeCategoryId_EQ: 'archivesType'
            }
        }, {
            field: 'totalPage',
            title: 'T_LIMS_ARCHIVES_MANAGE.TOTALPAGE'
        }, {
            field: 'storeLocation',
            title: 'T_LIMS_ARCHIVES_MANAGE.STORELOCATION'
        }, {
            field: 'remark',
            title: 'T_LIMS_ARCHIVES_MANAGE.REMARK',
            editor: true,
            validators: ['strLength[0,66]'],
        }]
    },

    getBaseInfoFormFields: function () {
        return [{
            field: 'archivesCode',
            title: 'T_LIMS_ARCHIVES_MANAGE.ARCHIVESCODE',
            validators: ['strLength[0,10]', 'notEmpty', 'remote[/secure/basemodule/rm/archives-manages/action/validate-unique]'],
            preInsert: true
        }, {
            field: 'archivesName',
            title: 'T_LIMS_ARCHIVES_MANAGE.ARCHIVESNAME',
            validators: ['strLength[0,53]', 'notEmpty'],
            preInsert: true
        }, {
            field: 'archivesType',
            title: 'T_LIMS_ARCHIVES_MANAGE.ARCHIVESTYPE',
            validators: ['strLength[0,8]', 'notEmpty'],
            preInsert: true,
            type: 'select',
            category: 'sys',
            firstBlank: false,
            param: {
                codeCategoryId_EQ: 'archivesType'
            }
        }, {
            field: 'totalPage',
            title: 'T_LIMS_ARCHIVES_MANAGE.TOTALPAGE',
            validators: ['strLength[0,4]'],
            preInsert: true
        }, {
            field: 'storeLocation',
            title: 'T_LIMS_ARCHIVES_MANAGE.STORELOCATION',
            validators: ['strLength[0,66]'],
            preInsert: true
        }, {
            field: 'status',
            title: 'T_LIMS_ARCHIVES_MANAGE.STATUS',
            validators: ['strLength[0,8]']
        }, {
            field: 'remark',
            title: 'T_LIMS_ARCHIVES_MANAGE.REMARK',
            validators: ['strLength[0,66]'],
            preInsert: true
        },]
    },

    getChooseListColumns: function () {
        return [{index: true},{
            field: 'archivesCode',
            title: 'T_LIMS_ARCHIVES_MANAGE.ARCHIVESCODE'
        }, {
            field: 'archivesName',
            title: 'T_LIMS_ARCHIVES_MANAGE.ARCHIVESNAME'
        }, {
            field: 'archivesType',
            title: 'T_LIMS_ARCHIVES_MANAGE.ARCHIVESTYPE'
        }, {
            field: 'totalPage',
            title: 'T_LIMS_ARCHIVES_MANAGE.TOTALPAGE'
        }, {
            field: 'storeLocation',
            title: 'T_LIMS_ARCHIVES_MANAGE.STORELOCATION'
        }, {
            field: 'status',
            title: 'T_LIMS_ARCHIVES_MANAGE.STATUS'
        }, {
            field: 'remark',
            title: 'T_LIMS_ARCHIVES_MANAGE.REMARK'
        },]
    },

    baseUrl: IFM_CONTEXT + '/secure/basemodule/rm/archives-manages',

    /**
     * 档案操作
     */
    // 借阅记录
    getBorrowEditListColumns: function () {
        return [{
            checkbox: true
        }, {index: true}, {
            field: 'borrowTime',
            validators: ['notEmpty'],
            title: 'T_LIMS_ARCHIVES_HANDLE.BORROWTIME',
            type: 'date',
        }, {
            field: 'archivesCode',
            title: 'T_LIMS_ARCHIVES_HANDLE.ARCHIVESCODE',
            type: 'link'
        }, {
            field: 'ext$.archivesname',
            title: 'T_LIMS_ARCHIVES_MANAGE.ARCHIVESNAME'
        }, {
            field: 'ext$.archivestype',
            title: 'T_LIMS_ARCHIVES_MANAGE.ARCHIVESTYPE',
            type: 'select',
            category: 'sys',
            firstBlank: false,
            param: {
                codeCategoryId_EQ: 'archivesType'
            }
        }, {
            field: 'ext$.storelocation',
            title: 'T_LIMS_ARCHIVES_MANAGE.STORELOCATION'
        }, {
            field: 'loanPurpose',
            title: 'T_LIMS_ARCHIVES_HANDLE.LOANPURPOSE'
        }, {
            field: 'borrower',
            validators: ['notEmpty'],
            title: 'T_LIMS_ARCHIVES_HANDLE.BORROWER'
        }, {
            field: 'receptionist',
            validators: ['notEmpty'],
            title: 'T_LIMS_ARCHIVES_HANDLE.RECEPTIONIST'
        }, {
            field: 'audit',
            validators: ['notEmpty'],
            title: 'T_LIMS_ARCHIVES_HANDLE.AUDIT'
        }, {
            field: 'returnTime',
            validators: ['notEmpty'],
            title: 'T_LIMS_ARCHIVES_HANDLE.RETURNTIME'
        }, {
            field: 'returner',
            validators: ['notEmpty'],
            title: 'T_LIMS_ARCHIVES_HANDLE.RETURNER'
        }, {
            field: 'signer',
            validators: ['notEmpty'],
            title: 'T_LIMS_ARCHIVES_HANDLE.SIGNER'
        }, {
            field: 'remark',
            title: 'T_LIMS_ARCHIVES_HANDLE.REMARK'
        },]
    },

    getBorrowBaseInfoFormFields: function () {
        return [{
            field: 'borrowTime',
            title: 'T_LIMS_ARCHIVES_HANDLE.BORROWTIME',
            type: 'date',
            preInsert: true,
            validators: ['notEmpty'],
            onChange: function (field, value, index) {
                var form = this
                var data = form.getData()
                if (value && value !== '' && data.returnTime && data.returnTime !== '') {
                    var returnTime = new Date(data.returnTime)
                    var borrowTime = new Date(value)
                    if (borrowTime > returnTime) {
                        Gikam.alert('BASEMODULE.RM.ARCHIVESMANAGES.TIP.BORROWTIME_OVER_RETURNTIME')
                        form.setData({
                            returnTime: ''
                        })
                    }
                }
            },
        }, {
            field: 'loanPurpose',
            title: 'T_LIMS_ARCHIVES_HANDLE.LOANPURPOSE',
            validators: ['strLength[0,53]'],
            preInsert: true
        }, {
            field: 'borrower',
            title: 'T_LIMS_ARCHIVES_HANDLE.BORROWER',
            validators: ['strLength[0,20]', 'notEmpty'],
            preInsert: true,
            type: 'choose',
            category: 'user',
            single: true,
            onAfterChoose: function (row, index) {
                if (row && row[0]) {
                    this.setData({
                        borrowerId: row[0].id,
                        borrower: row[0].userName
                    })
                }
            },
            onClean: function () {
                this.setData({
                    borrower: '',
                    borrowerId: ''
                })
            },
        }, {
            field: 'receptionist',
            title: 'T_LIMS_ARCHIVES_HANDLE.RECEPTIONIST',
            validators: ['strLength[0,20]', 'notEmpty'],
            preInsert: true,
            type: 'choose',
            category: 'user',
            single: true,
            onAfterChoose: function (row, index) {
                if (row && row[0]) {
                    this.setData({
                        receptionistId: row[0].id,
                        receptionist: row[0].userName
                    })
                }
            },
            onClean: function () {
                this.setData({
                    receptionist: '',
                    receptionistId: ''
                })
            },
        }, {
            field: 'audit',
            title: 'T_LIMS_ARCHIVES_HANDLE.AUDIT',
            validators: ['strLength[0,20]', 'notEmpty'],
            preInsert: true,
            type: 'choose',
            category: 'user',
            single: true,
            onAfterChoose: function (row, index) {
                if (row && row[0]) {
                    this.setData({
                        auditId: row[0].id,
                        audit: row[0].userName
                    })
                }
            },
            onClean: function () {
                this.setData({
                    audit: '',
                    auditId: ''
                })
            },
        }, {
            field: 'returnTime',
            title: 'T_LIMS_ARCHIVES_HANDLE.RETURNTIME',
            type: 'date',
            preInsert: true,
            validators: ['notEmpty'],
            onChange: function (field, value, index) {
                var form = this
                var data = form.getData()
                // console.log(data,value)
                if (value && value !== '' && data.borrowTime && data.borrowTime !== '') {
                    var returnTime = new Date(value)
                    var borrowTime = new Date(data.borrowTime)
                    if (borrowTime > returnTime) {
                        Gikam.alert('BASEMODULE.RM.ARCHIVESMANAGES.TIP.BORROWTIME_OVER_RETURNTIME')
                        form.setData({
                            returnTime: ''
                        })
                    }
                }
            },
        }, {
            field: 'returner',
            title: 'T_LIMS_ARCHIVES_HANDLE.RETURNER',
            validators: ['strLength[0,20]', 'notEmpty'],
            preInsert: true,
            type: 'choose',
            category: 'user',
            single: true,
            onAfterChoose: function (row, index) {
                if (row && row[0]) {
                    this.setData({
                        returnerId: row[0].id,
                        returner: row[0].userName
                    })
                }
            },
            onClean: function () {
                this.setData({
                    returner: '',
                    returnerId: ''
                })
            },
        }, {
            field: 'signer',
            title: 'T_LIMS_ARCHIVES_HANDLE.SIGNER',
            validators: ['strLength[0,20]', 'notEmpty'],
            preInsert: true,
            type: 'choose',
            category: 'user',
            single: true,
            onAfterChoose: function (row, index) {
                if (row && row[0]) {
                    this.setData({
                        signerId: row[0].id,
                        signer: row[0].userName
                    })
                }
            },
            onClean: function () {
                this.setData({
                    signer: '',
                    signerId: ''
                })
            },
        }, {
            field: 'remark',
            title: 'T_LIMS_ARCHIVES_HANDLE.REMARK',
            validators: ['strLength[0,66]'],
            preInsert: true
        },]
    },

    // 移交记录
    getMoveEditListColumns: function () {
        return [{
            checkbox: true
        }, {index: true}, {
            field: 'moveTime',
            validators: ['notEmpty'],
            title: 'T_LIMS_ARCHIVES_HANDLE.MOVETIME'
        }, {
            field: 'archivesCode',
            // validators: ['notEmpty'],
            title: 'T_LIMS_ARCHIVES_HANDLE.ARCHIVESCODE',
            type: 'link'
        }, {
            field: 'ext$.archivesname',
            title: 'T_LIMS_ARCHIVES_MANAGE.ARCHIVESNAME'
        }, {
            field: 'ext$.archivestype',
            title: 'T_LIMS_ARCHIVES_MANAGE.ARCHIVESTYPE',
            type: 'select',
            category: 'sys',
            firstBlank: false,
            param: {
                codeCategoryId_EQ: 'archivesType'
            }
        }, {
            field: 'originalOrCopy',
            title: 'T_LIMS_ARCHIVES_HANDLE.ORIGINALORCOPY',
            type: 'select',
            category: 'sys',
            firstBlank: false,
            param: {
                codeCategoryId: 'originalOrCopy'
            },
            validators: ['notEmpty'],
        }, {
            field: 'copies',
            title: 'T_LIMS_ARCHIVES_HANDLE.COPIES'
        }, {
            field: 'copiesPerPage',
            title: 'T_LIMS_ARCHIVES_HANDLE.COPIESPERPAGE'
        }, {
            field: 'totalPage',
            title: 'T_LIMS_ARCHIVES_HANDLE.TOTALPAGE'
        }, {
            field: 'receptionist',
            validators: ['notEmpty'],
            title: 'T_LIMS_ARCHIVES_HANDLE.RECEPTIONIST'
        }, {
            field: 'signer',
            validators: ['notEmpty'],
            title: 'T_LIMS_ARCHIVES_HANDLE.SIGNER'
        }, {
            field: 'remark',
            title: 'T_LIMS_ARCHIVES_HANDLE.REMARK'
        },]
    },

    getMoveBaseInfoFormFields: function () {
        return [{
            field: 'moveTime',
            title: 'T_LIMS_ARCHIVES_HANDLE.MOVETIME',
            type: 'date',
            preInsert: true,
            validators: ['notEmpty'],
        }, {
            field: 'originalOrCopy',
            title: 'T_LIMS_ARCHIVES_HANDLE.ORIGINALORCOPY',
            validators: ['strLength[0,8]', 'notEmpty'],
            preInsert: true,
            type: 'select',
            category: 'sys',
            firstBlank: false,
            param: {
                codeCategoryId: 'originalOrCopy'
            }
        }, {
            field: 'copies',
            title: 'T_LIMS_ARCHIVES_HANDLE.COPIES',
            validators: ['strLength[0,8]'],
            preInsert: true
        }, {
            field: 'copiesPerPage',
            title: 'T_LIMS_ARCHIVES_HANDLE.COPIESPERPAGE',
            validators: ['strLength[0,8]'],
            preInsert: true
        }, {
            field: 'totalPage',
            title: 'T_LIMS_ARCHIVES_HANDLE.TOTALPAGE',
            validators: ['strLength[0,8]'],
            preInsert: true
        }, {
            field: 'receptionist',
            title: 'T_LIMS_ARCHIVES_HANDLE.RECEPTIONIST',
            validators: ['strLength[0,20]', 'notEmpty'],
            preInsert: true,
            type: 'choose',
            category: 'user',
            single: true,
            onAfterChoose: function (row, index) {
                if (row && row[0]) {
                    this.setData({
                        receptionistId: row[0].id,
                        receptionist: row[0].userName
                    })
                }
            },
            onClean: function () {
                this.setData({
                    receptionist: '',
                    receptionistId: ''
                })
            },
        }, {
            field: 'signer',
            title: 'T_LIMS_ARCHIVES_HANDLE.SIGNER',
            validators: ['strLength[0,20]', 'notEmpty'],
            preInsert: true,
            type: 'choose',
            category: 'user',
            single: true,
            onAfterChoose: function (row, index) {
                if (row && row[0]) {
                    this.setData({
                        signerId: row[0].id,
                        signer: row[0].userName
                    })
                }
            },
            onClean: function () {
                this.setData({
                    signer: '',
                    signerId: ''
                })
            },
        }, {
            field: 'remark',
            title: 'T_LIMS_ARCHIVES_HANDLE.REMARK',
            validators: ['strLength[0,66]'],
            preInsert: true
        },]
    },

    // 销毁记录
    getDestoryEditListColumns: function () {
        return [{
            checkbox: true
        }, {index: true}, {
            field: 'checkTime',
            validators: ['notEmpty'],
            title: 'T_LIMS_ARCHIVES_HANDLE.CHECKTIME'
        }, {
            field: 'archivesCode',
            title: 'T_LIMS_ARCHIVES_HANDLE.ARCHIVESCODE',
            type: 'link'
        }, {
            field: 'ext$.archivesname',
            title: 'T_LIMS_ARCHIVES_MANAGE.ARCHIVESNAME'
        }, {
            field: 'ext$.archivestype',
            title: 'T_LIMS_ARCHIVES_MANAGE.ARCHIVESTYPE',
            type: 'select',
            category: 'sys',
            firstBlank: false,
            param: {
                codeCategoryId_EQ: 'archivesType'
            }
        }, {
            field: 'destoryReason',
            validators: ['notEmpty'],
            title: 'T_LIMS_ARCHIVES_HANDLE.DESTORYREASON'
        }, {
            field: 'applyer',
            validators: ['notEmpty'],
            title: 'T_LIMS_ARCHIVES_HANDLE.APPLYER'
        }, {
            field: 'audit',
            validators: ['notEmpty'],
            title: 'T_LIMS_ARCHIVES_HANDLE.AUDIT'
        }, {
            field: 'destoryTime',
            validators: ['notEmpty'],
            title: 'T_LIMS_ARCHIVES_HANDLE.DESTORYTIME'
        }, {
            field: 'destoryer',
            validators: ['notEmpty'],
            title: 'T_LIMS_ARCHIVES_HANDLE.DESTORYER'
        }, {
            field: 'supervisor',
            validators: ['notEmpty'],
            title: 'T_LIMS_ARCHIVES_HANDLE.SUPERVISOR'
        }, {
            field: 'remark',
            title: 'T_LIMS_ARCHIVES_HANDLE.REMARK'
        },]
    },

    getDestoryBaseInfoFormFields: function () {
        return [{
            field: 'checkTime',
            title: 'T_LIMS_ARCHIVES_HANDLE.CHECKTIME',
            type: 'date',
            preInsert: true,
            validators: ['notEmpty'],
        }, {
            field: 'destoryReason',
            title: 'T_LIMS_ARCHIVES_HANDLE.DESTORYREASON',
            validators: ['strLength[0,53]', 'notEmpty'],
            preInsert: true
        }, {
            field: 'applyer',
            title: 'T_LIMS_ARCHIVES_HANDLE.APPLYER',
            validators: ['strLength[0,20]', 'notEmpty'],
            preInsert: true,
            type: 'choose',
            category: 'user',
            single: true,
            onAfterChoose: function (row, index) {
                if (row && row[0]) {
                    this.setData({
                        applyerId: row[0].id,
                        applyer: row[0].userName
                    })
                }
            },
            onClean: function () {
                this.setData({
                    applyer: '',
                    applyerId: ''
                })
            },
        }, {
            field: 'audit',
            title: 'T_LIMS_ARCHIVES_HANDLE.AUDIT',
            validators: ['strLength[0,20]', 'notEmpty'],
            preInsert: true,
            type: 'choose',
            category: 'user',
            single: true,
            onAfterChoose: function (row, index) {
                if (row && row[0]) {
                    this.setData({
                        auditId: row[0].id,
                        audit: row[0].userName
                    })
                }
            },
            onClean: function () {
                this.setData({
                    audit: '',
                    auditId: ''
                })
            },
        }, {
            field: 'destoryTime',
            title: 'T_LIMS_ARCHIVES_HANDLE.DESTORYTIME',
            type: 'date',
            preInsert: true,
            validators: ['notEmpty'],
        }, {
            field: 'destoryer',
            title: 'T_LIMS_ARCHIVES_HANDLE.DESTORYER',
            validators: ['strLength[0,20]', 'notEmpty'],
            preInsert: true,
            type: 'choose',
            category: 'user',
            single: true,
            onAfterChoose: function (row, index) {
                if (row && row[0]) {
                    this.setData({
                        destoryerId: row[0].id,
                        destoryer: row[0].userName
                    })
                }
            },
            onClean: function () {
                this.setData({
                    destoryer: '',
                    destoryerId: ''
                })
            },
        }, {
            field: 'supervisor',
            title: 'T_LIMS_ARCHIVES_HANDLE.SUPERVISOR',
            validators: ['strLength[0,20]', 'notEmpty'],
            preInsert: true,
            type: 'choose',
            category: 'user',
            single: true,
            onAfterChoose: function (row, index) {
                if (row && row[0]) {
                    this.setData({
                        supervisorId: row[0].id,
                        supervisor: row[0].userName
                    })
                }
            },
            onClean: function () {
                this.setData({
                    supervisor: '',
                    supervisorId: ''
                })
            },
        }, {
            field: 'remark',
            title: 'T_LIMS_ARCHIVES_HANDLE.REMARK',
            validators: ['strLength[0,66]'],
            preInsert: true
        },]
    },
})
